
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<%@ page language="java" contentType="text/html;UTF-8" pageEncoding="UTF-8" %>
<%@ taglib prefix="s" uri="/struts-tags" %>

<html>
    
  <head>
    <title></title>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
    <script type="text/javascript" src="/Fonafe-Bienes/js/jquery.min.js"></script>
    <script type="text/javascript" src="/Fonafe-Bienes/js/jsindex.js"></script>
    <script type="text/javascript" src="/Fonafe-Bienes/js/jsvalidaciones.js"></script>
    <link href="/Fonafe-Bienes/css/default.css" type="text/css" rel="stylesheet" />
    <script type="text/javascript" src="/Fonafe-Bienes/js/jsvalidaciones.js"></script>
    <script type="text/javascript" src="/Fonafe-Bienes/js/paginacion/jquery.pagination.js"></script>
    <link rel="stylesheet" type="text/css" href="/Fonafe-Bienes/css/paginacion/pagination.css" />

    <script type="text/javascript">
      var items_per_page = 15;
        <s:set name="items_per_tabla" value="15" />
            (function($) {
                $(document).ready(function(){
                    initPagination();
                });

                function pageselectCallback(page_index, jq){
                    $('#Searchresult').empty();
                    var num_entries = $('#hiddenresult div.result').length;
                    var max_elem = Math.min((page_index+1) * items_per_page, num_entries);

                    for(var i=page_index*items_per_page;i<max_elem;i++) {
                        var new_content = $('#hiddenresult div.result:eq('+i+')').clone();
                        $('#Searchresult').append(new_content);
                    }
                    return false;
                }

                function initPagination() {
                    var num_entries = $('#hiddenresult div.result').length;
                    $("#Pagination").paginationList(num_entries, {
                        callback: pageselectCallback,
                        items_per_page: items_per_page,
                        num_display_entries: 4,
                        num_edge_entries: 2,
                        prev_text: '<<',
                        next_text: '>>'
                    });
                }

            })(jQuery);
            
  </script>
            
   
            
  </head>

   
    <body>
         <div id="header">
             <jsp:include page="/base/header_Login.jsp" flush="false"/>
             <jsp:include page="/base/menu_GLC.jsp" >
					<jsp:param name="parametro" value="inmueble" />
		     </jsp:include>  
           </div>
           
        <div id="main">
            
        <div id="cuerpo">
        <!--sub-menu-->
        <s:form name="formInmGLC" action="buscaInmueblesGLC" method="post" theme="simple">
            
        <div class="slide_menu align_left">
                  
                  <div class="c_busqueda">
                      <div class="titulo_c_busqueda">Buscador de Inmuebles</div>
                      <div class="cuadro_b_inicial no_border">
                          
                          <div class="bloque">
                          <span>Dept / Prov / Distrito</span>
                          <input autocomplete="off" id="TxtUbigeo" type="text" onkeyup="$.autocomplete($(this));" value="<s:property value="ubigeo"/>" class="texto_mediano"  name="ubigeo" size="30px"/>
                          </div>

                          
                          <div class="bloque">
                              <span>Tipo de Inmueble</span>
                            <s:select cssClass="etiquetaStruts" name="tipInmueble" headerKey="0" headerValue="--Todos--"  list="listTipoInmueble" listKey="idTipoInmueble" listValue="nombre" theme="simple"/>
                          </div>
                         
                          <div class="area_boton_envio">
                                <a href="javascript:document.formInmGLC.submit();" class="isbutton">Buscar</a>                                
                          </div>
                          
                      </div>
                      <ul>
                        
                          <li><a href="javascript:void(0)" class="top_item_sin_slide">Tipo de Contrato</a>
                              <div class="sub_menu_sin_hidden no_border">
                                  <div class="bloque">
                                  <ul class="paddins_li">
                                      
                                      <s:if test="%{tipContrato == 'Venta'}">
                                      <li>
                                          <input type="radio" name="tipContrato"  value="" class="align_left" onclick="document.formInmGLC.submit();" />
                                          <span class="align_left">Todos</span>
                                          <div class="clean_space"></div>
                                      </li>
                                      <li>
                                          <input type="radio" name="tipContrato" checked="true" value="Venta" class="align_left" onclick="document.formInmGLC.submit();" />
                                          <span class="align_left">Venta</span>
                                          <div class="clean_space"></div>
                                      </li>
                                      <li>
                                          <input type="radio" name="tipContrato" value="Alquiler" class="align_left" onclick="document.formInmGLC.submit();" />
                                          <span class="align_left">Alquiler</span>
                                          <div class="clean_space"></div>
                                      </li>
                                    </s:if>
                                      
                                    <s:if test="%{tipContrato == 'Alquiler'}">
                                        <li>
                                          <input type="radio" name="tipContrato"  value="" class="align_left" onclick="document.formInmGLC.submit();" />
                                           <span class="align_left">Todos</span>
                                           <div class="clean_space"></div>
                                      </li>
                                      <li>
                                          <input type="radio" name="tipContrato" value="Venta" class="align_left" onclick="document.formInmGLC.submit();" />
                                           <span class="align_left">Venta</span>
                                           <div class="clean_space"></div>
                                      </li>
                                      <li>
                                          <input type="radio" name="tipContrato" value="Alquiler" checked="true"  class="align_left" onclick="document.formInmGLC.submit();" />
                                          <span class="align_left">Alquiler</span>
                                          <div class="clean_space"></div>
                                      </li>
                                    </s:if>
                                      
                                    <s:if test="%{tipContrato != 'Alquiler' && tipContrato != 'Venta'}">
                                      <li>
                                          <input type="radio" name="tipContrato" checked="true" value="" class="align_left" onclick="document.formInmGLC.submit();" />
                                          <span class="align_left">Todos</span>
                                          <div class="clean_space"></div>
                                      </li>
                                      <li>
                                          <input type="radio" name="tipContrato" value="Venta" class="align_left" onclick="document.formInmGLC.submit();" />
                                           <span class="align_left">Venta</span>
                                           <div class="clean_space"></div>
                                      </li>
                                      <li>
                                          <input type="radio" name="tipContrato" value="Alquiler" class="align_left" onclick="document.formInmGLC.submit();" />
                                          <span class="align_left">Alquiler</span>
                                          <div class="clean_space"></div>
                                      </li>
                                    </s:if>
                                      
                                      
                                    
                            
                                  </ul>
                                  </div>
                                  
                              </div>
                          </li>
                          <li><a href="javascript:void(0)" class="top_item_sin_slide">Precio</a>
                              <div class="sub_menu_sin_hidden">
                                  <div class="bloque">
                                  <ul class="paddins_li">
                                      <li>
                                           
                                           
                                           <s:if test="%{tipMoneda == 'Sol'}">
                                               <input type="radio" name="tipMoneda" checked="true" value="Sol" class="align_left" />
                                               <span class="align_left">Sol</span>
                                               <div class="clean_space"></div>
                                               <input type="radio" name="tipMoneda" value="Dolar" class="align_left" />
                                               <span class="align_left">D&oacute;lar</span>
                                               <div class="clean_space"></div>
                                               <input type="radio" name="tipMoneda" value="Euro" class="align_left" />
                                               <span class="align_left">Euro</span>
                                               <div class="clean_space"></div>
                                           </s:if>
                                               
                                           <s:if test="%{tipMoneda == 'Dolar'}">
                                               <input type="radio" name="tipMoneda" value="Sol" class="align_left" />
                                               <span class="align_left">Sol</span>
                                               <div class="clean_space"></div>
                                               <input type="radio" name="tipMoneda" checked="true"  value="Dolar" class="align_left" />
                                               <span class="align_left">D&oacute;lar</span>
                                               <div class="clean_space"></div>
                                               <input type="radio" name="tipMoneda" value="Euro" class="align_left" />
                                               <span class="align_left">Euro</span>
                                               <div class="clean_space"></div>
                                           </s:if>
                                               
                                           <s:if test="%{tipMoneda == 'Euro'}">
                                               <input type="radio" name="tipMoneda" value="Sol" class="align_left" />
                                               <span class="align_left">Sol</span>
                                               <div class="clean_space"></div>
                                               <input type="radio" name="tipMoneda" value="Dolar" class="align_left" />
                                               <span class="align_left">D&oacute;lar</span>
                                               <div class="clean_space"></div>
                                               <input type="radio" name="tipMoneda"  checked="true"  value="Euro" class="align_left" />
                                               <span class="align_left">Euro</span>
                                               <div class="clean_space"></div>
                                           </s:if>
                                               
                                               
                                           <s:if test="%{tipMoneda != 'Sol' && tipMoneda != 'Dolar' && tipMoneda != 'Euro'}">
                                               <input type="radio" name="tipMoneda" value="Sol" class="align_left" />
                                               <span class="align_left">Sol</span>
                                               <div class="clean_space"></div>
                                               <input type="radio" name="tipMoneda" value="Dolar" class="align_left" />
                                               <span class="align_left">D&oacute;lar</span>
                                               <div class="clean_space"></div>
                                               <input type="radio" name="tipMoneda" value="Euro" class="align_left" />
                                               <span class="align_left">Euro</span>
                                               <div class="clean_space"></div>
                                           </s:if>
                                           
                                      </li>
                                      <li>
                                          <span class="align_left span_block">De</span>
                                          <input type="text" class="align_left texto_precio" id="TxtprecioDesde" name="precioDesde" value="<s:property value="precioDesde"/>"  onkeypress="return $.solonumerodecimal(event);"/>
                                          <div class="clean_space"></div>
                                      </li>
                                      <li>
                                          <span class="align_left span_block">a</span>
                                          <input type="text" class="align_left texto_precio" id="TxtprecioHasta" name="precioHasta" value="<s:property value="precioHasta"/>"  onkeypress="return $.solonumerodecimal(event);"/>
                                          <div class="clean_space"></div>
                                      </li>
                                      
                            
                                  </ul>
                                  </div>
                                   <div class="area_boton_envio" align="right">
                                        <a href="javascript:document.formInmGLC.submit();" ><u>Actualizar</u></a>         
                                   </div>

                              </div>
                          </li>
                          
                          <li><a href="javascript:void(0)" class="top_item_sin_slide">Estado</a>
                              <div class="sub_menu_sin_hidden">
                                  <div class="bloque">
                                  <ul class="paddins_li">
                                      <s:if test="%{estadoAct == 1}">
                                      <li>
                                          <input type="radio" name="estadoAct" checked="true" value="1" class="align_left" onclick="document.formInmGLC.submit();" />
                                           <span class="align_left">Activado</span>
                                           <div class="clean_space"></div>
                                      </li>
                                      <li>
                                          <input type="radio" name="estadoAct" value="0" class="align_left" onclick="document.formInmGLC.submit();" />
                                          <span class="align_left">Desactivado</span>
                                          <div class="clean_space"></div>
                                      </li>
                                    </s:if>
                                      
                                    <s:if test="%{estadoAct == 0}">
                                      <li>
                                          <input type="radio" name="estadoAct" value="1" class="align_left" onclick="document.formInmGLC.submit();" />
                                           <span class="align_left">Activado</span>
                                           <div class="clean_space"></div>
                                      </li>
                                      <li>
                                          <input type="radio" name="estadoAct" value="0" checked="true"  class="align_left" onclick="document.formInmGLC.submit();" />
                                          <span class="align_left">Desactivado</span>
                                          <div class="clean_space"></div>
                                      </li>
                                    </s:if>
                                    <s:if test="%{estadoAct != 1 && estadoAct != 0}">
                                      <li>
                                          <input type="radio" name="estadoAct" value="1" checked="true" class="align_left" onclick="document.formInmGLC.submit();" />
                                           <span class="align_left">Activado</span>
                                           <div class="clean_space"></div>
                                      </li>
                                      <li>
                                          <input type="radio" name="estadoAct" value="0" class="align_left" onclick="document.formInmGLC.submit();" />
                                          <span class="align_left">Desactivado</span>
                                          <div class="clean_space"></div>
                                      </li>
                                    </s:if>
                                      
                                  </ul>
                                  </div>
                                  
                              </div>
                          </li>
                      </ul>
                  </div>

          </div>
        </s:form>
        
        <!--listado-->
        
        <div class="slide_content align_rigth">
                           
                 <div class="contenido_grilla">
                      <table cellspacing="0" cellpadding="0" class="tabla_grilla">                          
                              <tbody>
                                  <tr>
                                      <td colspan="4" >
                                          <s:url action="irNuevoInmueble" id="irNuevoInm"/>
                                          <s:a href="%{irNuevoInm}" cssClass="botones_funciones position_r_centro">Nuevo Inmueble</s:a>
                                          
                                      </td>
                                  </tr>   
                              <tr>
                                  <th class="width_item1"><span class="bg1"></span>Nombre</th>
                                  <th class="width_item2_glc">Descripci&oacute;n</th>
                                  <th class="width_item3">Precio</th>
                                  <th class="width_item3">Estado</th>
                                  <th class="width_item4"><span class="bg2"></span>Opciones</th>
                              </tr>
                      </tbody></table>
                      <div id="Searchresult">Cargando...</div>
                      <s:if test="%{listInmueble.size() == 0}">
                         <div class="msg-noresult msg-info" style="width: 500px;" align="center">
                          Lo sentimos, no encontramos resultados para tu b&uacute;squeda,<br/>
                          intenta otra b&uacute;squeda, se pueden encontrar muchas cosas.
                          </div>
                      </s:if>
                      <div id="Pagination" style="width:950px "></div>
                      <div id="hiddenresult" style="display:none;">
                      <s:iterator value="listInmueble" var="bean">
                      <div class="result">
                      <div class="contenido_items_body">
                          <div class="item_resultado">
                              <div class="img_item width_item1">
                                    <s:url action="verImagenInm" id="verImag"/>
                                    <img alt="<s:property value="nombre" escapeCsv="false"/>" src="Fonafe-Bienes/struts/verImagenInm?idFoto=<s:property value="id"/>"  width="120" height="90" style="max-width: 120px; max-height: 90px;"/>
                              </div>
                              <div class="descripcion_item_glc width_item2_glc">
                                  <span class="etiqueta_1"><s:property value="nombre" escapeCsv="false"/><br></span>
                                  <span class="etiqueta_3">
                                      <s:if test="%{descripcion.length() > 100}">
                                        <s:property value="descripcion.substring(0, 100)" escapeCsv="false"/> ...
                                      </s:if>
                                      <s:else>
                                        <s:property value="descripcion" escapeCsv="false"/>
                                      </s:else>
                                  </span>
                              </div>
                              <div class="fecha_item width_item3">
                                   <s:if test="%{tipoMoneda == 'Sol'}">
                                                        <s:set name="tipCoin">S/</s:set>
                                                    </s:if>
                                                    <s:elseif test="%{tipoMoneda == 'Dolar'}">
                                                        <s:set name="tipCoin">US$ </s:set>
                                                    </s:elseif>
                                                    <s:elseif test="%{tipoMoneda == 'Euro'}">
                                                        <s:set name="tipCoin">EUR </s:set>
                                                    </s:elseif>
                                                    <s:property value="tipCoin"/>&nbsp;<s:property value="vchPrecio"/>    
                                                                                        
                              </div>
                              <div class="fecha_item width_item3">
                                   <s:property value="estadoBien" />                                                                                         
                              </div>
                              <div class="precio_item width_item4">
                                  <s:if test="%{estadoAct==1}">
                                                       <s:url action="detalleInmuebleGLC" id="detInmueble">
                                                            <s:param name="idInmueble" value="id"></s:param>
                                                            
                                                        </s:url>
                                                        <s:url action="eliminarInmuebleGLC" id="eliminaInmueble">
                                                            <s:param name="idInmueble" value="id"></s:param>
                                                            
                                                        </s:url>
                                                        
                                                         <s:a href="%{detInmueble}">
                                                          <img height="25" width="25" alt="" src="/Fonafe-Bienes/img/file-edit.png"/>
                                                         </s:a>

                                                         <s:a href="%{eliminaInmueble}"  onclick="return confirm('Esta seguro de desactivar este Bien?')">
                                                          <img height="25" width="25" alt="" src="/Fonafe-Bienes/img/file-delete.png"/>
                                                         </s:a> 
                                 </s:if>
                                 <s:if test="%{estadoAct==0}">
                                                       <s:url action="verInmuebleGLC" id="verInmueble">
                                                            <s:param name="idInmueble" value="id"></s:param>
                                                            
                                                        </s:url>
                                                       
                                                         <s:a href="%{verInmueble}">
                                                          <img height="25" width="25" alt="" src="/Fonafe-Bienes/img/ver.jpeg"/>
                                                         </s:a>

                                 </s:if>
                              </div>
                              <div class="clean_space"></div>
                          </div>

                      </div>
                      </div>
                      </s:iterator>        
                  </div>
                 </div>           
         </div>
        
         <div class="clean_space"></div>
        
       </div>
        
        
        
        
        </div> 
                                          
           <div class="footer">
              <jsp:include page="/base/footer.jsp" flush="false" />               
          </div>
        
    </body>
   
</html>
